package com.example.spring.security.demo.controller;

import com.example.spring.security.demo.entity.ResponseResult;
import com.example.spring.security.demo.entity.User;
import com.example.spring.security.demo.service.UserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName UserController
 * @Description
 * @Author lichuanqi
 * @Date 2022/5/14 12:48
 * @Version 1.0
 **/
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/login")
    public ResponseResult login(@RequestBody User user) {
        return userService.login(user);
    }

    @RequestMapping("/logout")
    public ResponseResult logout() {
        return userService.logout();
    }
}
